﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace MikroTransfer
{
    public partial class frmMain : XtraForm
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {

        }

        private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (frmUrunEslestirme es = new frmUrunEslestirme())
            {
                es.ShowDialog();
            }
        }

        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (frmKontorFaturaAktarim knt = new frmKontorFaturaAktarim())
            {
                knt.ShowDialog();
            }
        }

        private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (frmMikroEvrakBirlestir bir = new frmMikroEvrakBirlestir())
            {
                bir.ShowDialog();
            }
        }

        private void barButtonItem6_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (frmScmEslestirme scm = new frmScmEslestirme())
            {
                scm.ShowDialog();
            }
        }

        private void barButtonItem7_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (frmScmAktarim scm = new frmScmAktarim())
            {
                scm.ShowDialog();
            }
        }

        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (frmDepoEslestir depo = new frmDepoEslestir())
            {
                depo.ShowDialog();
            }
        }

        private void barButtonItem9_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (frmNokiaAktarim nok = new frmNokiaAktarim())
            {
                nok.ShowDialog();
            }
        }

        private void barButtonItem10_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmAyarlar ayar = new frmAyarlar();
            ayar.ShowDialog();
        }

        private void barButtonItem11_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                CreateTable(Db.C02);
                CreateTable(Db.C04);
                CreateTable(Db.C14);
            }
            catch (Exception ex)
            {
                Logging.GetLog.ErrorLog(ex);
            }
        }

        private void CreateTable(Db dbsystem)
        {
            using (Query q = new Query(dbsystem))
            {
                q.Add("CREATE TABLE [dbo].[AKTARILANLAR]([kaynak_char_id] [int] NOT NULL,[hedef_char_id] [int] NOT NULL,CONSTRAINT [PK_AKTARILANLAR] PRIMARY KEY CLUSTERED ([kaynak_char_id] ASC,[hedef_char_id] ASC) WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]");
                q.Exec();
            }
        }

        private void barButtonItem12_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (frmHavaleAktarim hv = new frmHavaleAktarim())
            {
                hv.ShowDialog();
            }
        }

        private void barButtonItem15_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (frmHavaleEslestirme hv = new frmHavaleEslestirme())
            {
                hv.ShowDialog();
            }
        }

        private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (frmGrntHavaleEslestirme hv = new frmGrntHavaleEslestirme())
            {
                hv.ShowDialog();
            }
        }
    }
}
